<?php
    /*
     *      _______ _     _       _     _____ __  __ ______
     *     |__   __| |   (_)     | |   / ____|  \/  |  ____|
     *        | |  | |__  _ _ __ | | _| |    | \  / | |__
     *        | |  | '_ \| | '_ \| |/ / |    | |\/| |  __|
     *        | |  | | | | | | | |   <| |____| |  | | |
     *        |_|  |_| |_|_|_| |_|_|\_\\_____|_|  |_|_|
     */
    /*
     *     _________  ___  ___  ___  ________   ___  __    ________  _____ ______   ________
     *    |\___   ___\\  \|\  \|\  \|\   ___  \|\  \|\  \ |\   ____\|\   _ \  _   \|\  _____\
     *    \|___ \  \_\ \  \\\  \ \  \ \  \\ \  \ \  \/  /|\ \  \___|\ \  \\\__\ \  \ \  \__/
     *         \ \  \ \ \   __  \ \  \ \  \\ \  \ \   ___  \ \  \    \ \  \\|__| \  \ \   __\
     *          \ \  \ \ \  \ \  \ \  \ \  \\ \  \ \  \\ \  \ \  \____\ \  \    \ \  \ \  \_|
     *           \ \__\ \ \__\ \__\ \__\ \__\\ \__\ \__\\ \__\ \_______\ \__\    \ \__\ \__\
     *            \|__|  \|__|\|__|\|__|\|__| \|__|\|__| \|__|\|_______|\|__|     \|__|\|__|
     */
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2014 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: Dean <zxxjjforever@163.com>
// +----------------------------------------------------------------------
    namespace Portal\Controller;
    use Common\Controller\HomebaseController;
    /**
     * 首页
     */
    class IndexController extends HomebaseController {


        //首页 小夏是老猫除外最帅的男人了
        public function index() {
            $m_ads = M("HomeAds");
            $this->assign("open_menu",true);
            $pic_list = array();
            //首页轮播图
            for($i=1;$i<=5;$i++){
                $pic_list[$i] = $m_ads->where(array('tid'=>$i))->order("sort")->select();
            }

            $this->assign("pic_list",$pic_list);

            //获取推荐1的商品
            $m_product = M("Products");
            $rec_p_list1 = $m_product->where(array("home_type"=>1))->order("sort")->select();
            $rec_p_list2 = $m_product->where(array("home_type"=>2))->order("sort")->select();
            $this->assign("rec_p_list1",$rec_p_list1);
            $this->assign("rec_p_list2",$rec_p_list2);
            $this->display(":index");
        }

    }


